package com.qf.day06.homework;
//    创建一个子类：战士， 独有的属性，怒气值。独有的方法，英勇打击，（攻击力=力量的上下百分之20*2，消耗20怒气）。
import java.util.Random;
//继承Hero父级
public class Warrior extends Hero {
 double anger;

    public double getAnger() {
        return anger;
    }

    public void setAnger(double anger) {
        this.anger = anger;
    }
    public void heroicAttack(){
        String name =getName();
        double anger = getAnger();


        double Strength =  getStrength();

        Random random = new Random();
        int num = random.nextInt(40)-20+1; //力量的上下百分之20*2
        double strength = ((num*0.01)*getStrength()+getStrength())*2;
        if (anger>=20) {
            System.out.println(this.name+"发动技能:英勇打击,攻击力为"+strength);
            System.out.println(this.name+"怒气值为"+(anger-20));//消耗20怒气

        }else {System.out.println("怒气不足");}

    }
    public Warrior(String name, double strength, double intelligence, double agile,double anger) {
        super(name, strength, intelligence, agile); //父级构造
        this.anger =anger; //自己构造
    }
}
